//
//  ChargeResultTableViewController.m
//  ZiJinLian
//
//  Created by 🐛 on 2017/9/18.
//  Copyright © 2017年 weimengyu. All rights reserved.
//

#import "ChargeResultTableViewController.h"

@interface ChargeResultTableViewController ()

@end

@implementation ChargeResultTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=MyString(@"结果");
    if (self.styple==1) {
        [self SucceedView];
    }else{
        [self FailView];
    }
    // Do any additional setup after loading the view.
}

//成功页面
-(void)SucceedView{
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, MainW, MainH)];
    view.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:view];
    UIImageView*headImg=[[UIImageView alloc]init];
    headImg.image=[UIImage imageNamed:@"img_success_monk"];
    [view addSubview:headImg];
    [headImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(100);
        make.centerX.mas_equalTo(view.mas_centerX);
        make.width.mas_equalTo(180);
        make.height.mas_equalTo(210);
    }];
    UILabel *label=[[UILabel alloc]init];
    label.text=MyString(@"充值成功");
    label.textColor=TextColor3;
    label.font=FontAndStyle14;
    label.textAlignment=1;
    [view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(headImg.mas_bottom).offset(20);
        make.right.mas_equalTo(0);
        make.width.mas_equalTo(MainW);
        make.height.mas_equalTo(20);
    }];
    UIButton *button=[[UIButton alloc]init];
    [button setTitle:MyString(@"完成") forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.tag=1;
    [button addTarget:self action:@selector(FinishClick:) forControlEvents:UIControlEventTouchUpInside];
    button.backgroundColor=Red_Color;
    [view addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(label.mas_bottom).offset(20);
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(MainW-20);
        make.height.mas_equalTo(50);
    }];
    ViewRadius(button, 5);
    
    
    
}
//失败页面
-(void)FailView{
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, MainW, MainH)];
    view.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:view];
    UIImageView*headImg=[[UIImageView alloc]init];
    headImg.image=[UIImage imageNamed:@"img_fail_monk"];
    [view addSubview:headImg];
    [headImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(100);
        make.centerX.mas_equalTo(view.mas_centerX);
        make.width.mas_equalTo(180);
        make.height.mas_equalTo(210);
    }];
    UILabel *label=[[UILabel alloc]init];
    label.textColor=tableBarRedColor;
    label.textAlignment=1;
    label.font=FontAndStyle14;
    label.text=MyString(@"充值失败");
    [view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(headImg.mas_bottom).offset(20);
        make.right.mas_equalTo(0);
        make.width.mas_equalTo(MainW);
        make.height.mas_equalTo(20);
    }];
    UIButton *button=[[UIButton alloc]init];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.tag=3;
    [button addTarget:self action:@selector(FinishClick:) forControlEvents:UIControlEventTouchUpInside];
    [button setBackgroundColor:tableBarRedColor];
    [view addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(label.mas_bottom).offset(20);
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(MainW-20);
        make.height.mas_equalTo(50);
    }];
    ViewRadius(button, 5);
    [button setTitle:MyString(@"重新充值") forState:UIControlStateNormal];
}
-(void)FinishClick:(UIButton *)sender{
    
[self.navigationController popViewControllerAnimated:YES];
    
    
}

@end
